import { PageEnum } from '/@/enums/pageEnum';
import { PAGE_NOT_FOUND_ROUTE } from '../constant';
import { testRoutes } from './testRouter';
const modules = import.meta.globEager('./moudules/**/*.ts');
const routeModuleList: any = [];
Object.keys(modules).forEach((v) => {
  const mod = modules[v].default || {};
  const modList = Array.isArray(mod) ? [...mod] : [mod];
  routeModuleList.push(...modList);
});

// 所有需二次验权的路由路由
export const asyncRoutes = [PAGE_NOT_FOUND_ROUTE, ...routeModuleList];

export const RootRoute = {
  path: '/',
  name: 'Root',
  redirect: PageEnum.BASE_HOME,
  meta: {
    title: 'Root',
  },
};

export const LoginRoute = {
  path: '/login',
  name: 'Loagin',
  component: () => import('/@/views/sys/login/Login.vue'),
  meta: {
    title: '登录',
  },
};

// 基础路由不用权限
export const basicRoutes = [LoginRoute, RootRoute, ...testRoutes];
